import Mock from './mock.angular';

Mock.mock('/api/v1/identity/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        fullName: '@cname',
        idNo: '@id',
        postName: '@word',
        rfidNo: '@word',
        collectTime: '@date',
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/identity/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/identity/get', 'get', {
  success: true,
  message: '',
  code: 200,
  data: {
    id: '@id',
    orgId: '@id',
    fullName: '@cname',
    idNo: '@id',
    rfidNo: '@id',
    collectTime: '@date',
    idCardBean: {
      id: '@id',
      name: '@cname',
      'sex|1': [1, 2],
      'nation|1': ['汉族', '傣族'],
      birthday: '@date',
      address: '@province@city@zip',
      issueUnit: '@province@city()公安局',
      validPeriod: '1986-2016',
      photoId: '@id',
    },
    fingerPrintList: [
      {
        id: '@id',
        idNo: '@id',
        type: '@id',
        imageId: '@id',
      },
    ],
  },
});

Mock.mock('/api/v1/staff/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staffInOut/out/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staffInOut/in/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staff/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staff/update', 'post', {
  success: true,
  message: '',
  code: 200,
});


Mock.mock('/api/v1/staff/get', 'get', {
  success: true,
  message: '',
  code: 200,
  data: {
    personCollectBean: {
      id: '@id',
      orgId: '@id',
      fullName: '@cname',
      idNo: '@id',
      rfidNo: '@id',
      collectTime: '@date',
      idCardBean: {
        id: '@id',
        name: '@cname',
        'sex|1': [1, 2],
        'nation|1': ['汉族', '傣族'],
        birthday: '@date',
        address: '@province@city@zip',
        issueUnit: '@province@city()公安局',
        validPeriod: '1986-2016',
        photoId: '@id',
      },
    },
    orgPersonBean: {
      idNo: '@id',
      cellphone: '@id',
      orgName: '@word',
      fullName: '@cname',
      code: '@id',
      'type|1': [1, 2, 3],
      'degree|1': ['初中', '高中', '大学'],
      nativePlace: '@word',
      inTime: '@date',
      outTime: '@date',
      postCode: '@id',
      postName: '@word',
      remark: '@word',
      inOutStatus: 1,
      'departmentName|1': ['bumen1', 'bumen2'],
    },
    'certificateList|2-5': [
      {
        id: '@id',
        type: '@word',
        code: '@word',
        issueUnit: '@word',
        issueDate: '@date',
        validPeriod: '2015-2016',
      },
    ],
    'orgPersonFileList|2-5': [
      {
        'type|1': [1, 2],
        fileId: '@id',
        fileBean: {
          id: '@id',
          fileName: '@word',
        },
      },
    ],
  },
});

Mock.mock('/api/v1/staff/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        fullName: '@cname',
        idNo: '@id',
        code: '@id',
        postName: '@word',
        'type|1': [1, 2, 3],
        'inOutStatus|1': [1, 2],
        inTime: '@date',
        departmentName: '@word',
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/safeActivety/training/queryByStaff', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        startTime: '@date',
        name: '@cname',
        site: '@word',
        organizer: '@cname',
        compere: '@cname',
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/safeActivety/disclosure/queryByStaff', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        startTime: '@date',
        name: '@cname',
        'technicalType|1': [1, 2],
        site: '@word',
        compere: '@cname',
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/staffInOut/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        recordTime: '@date',
        'type|1': [1, 2],
      },
    ],
  };
  return Mock.mock(respData);
}));
